<?php

namespace App\Http\Presenters;

use Laracasts\Presenter\Presenter;

class GradePresenter extends Presenter
{

    public function WeekDay()
    {
        if ($this->common == 1) {
            switch ($this->week) {
                case 6:
                    $value = '<span class="green">星期六</span>';
                    break;
                case 7:
                    $value = '<span class="red">星期天</span>';
                    break;
                default:
                    $value = '';
                    break;
            }
        } else {
            $value = date('Y年n月j日', $this->study_date);
        }

        return $value;
    }

    public function Publish()
    {
        switch ($this->status) {
            case 1:
                return '<span class="green">公布</span>';
                break;
            case 0:
                return '<span class="grey">未公布</span>';
                break;
            default:
                break;
        }
    }


    public function LimitedStatus()
    {
        switch ($this->limited) {
            case 1:
                $value = '<span class="red">是</span>';
                break;
            case 0:
                $value = '<span class="green">否</span>';
                break;
            default:
                break;
        }
        return $value;
    }

    public function ExamStatus()
    {
        switch ($this->exam) {
            case 1:
                $value = '<span class="red">是</span>';
                break;
            case 0:
                $value = '<span class="green">否</span>';
                break;
            default:
                break;
        }
        return $value;
    }

    public function OpusStatus()
    {
        return $this->opus == 1 ? '<span class="red">需上交作品</span>' : '';

    }

}
